﻿@*   Tham số yêu cầu:
ViewBag._ListProduct : danh sách sản phẩm đc hiển thị*@
@using MobiShop.Models
@{
    List<Product> list = ViewBag._ListProduct;
}

@if (list != null && list.Count > 0)
{
<table width="100%" border="0" cellspacing="0" cellpadding="0">
@for (int i = 0; i < list.Count; i = i + 4)
{
    <tr>
        
   
    @for (int j = 0; j < 4; j++)
    {
        int k = i + j;
        if (k >= list.Count)
        {
            break;
        }
        Product sp = list[k];
    <td align="center">
       <table width="131" border="0" cellpadding="0" cellspacing="0" class="products-bg">
          <tr>
            <td height="79" align="center" valign="top" style="padding-top:10px;">
                <table width="1" border="0" cellspacing="0" cellpadding="0">

                    <tr>

                    <td>
                    <a href="/Home/Details/@sp.id">
                    <img alt="" src="@Url.Content("~/Content/images/" + @sp.image)" width="111" height="109" title="@sp.description" style="border:0px;" />
                    </a>
                    </td>

                    </tr>

                </table>
            </td>
         </tr>
         <tr>
            <td align="center" class="text3">Price:<span style="color:Red;"> @String.Format("{0:0,0}", sp.price)</span><text> Vnđ</text></td>
         </tr>
         <tr>
            <td  valign="bottom">
                <table width="128" border="0" cellpadding="0" cellspacing="0" class="blue-bg">
                  <tr>
                    <td width="9">&nbsp;</td>
                    <td width="67" class="link3">
                        <a href="/Order/ManageBasket?AddItem=@sp.id" class="link3">Add to Cart</a>
                    </td>
                    <td width="40" align="right" class="link3">
                        @Html.ActionLink("Details", "Details", "Home", new { id = sp.id }, new { @class = "link3" })
                    </td>
                    <td width="12">&nbsp;</td>
                  </tr>
                </table>
            </td>
          </tr>
        <tr>
            <td valign="top" height="3"></td>
        </tr>
       </table>
    </td>
    }

    </tr>
    <tr>
   <td valign="top" height="20" colspan="4"></td>
  </tr>
}
</table>
}